/**
 * Definition for singly-linked list.
 * function ListNode(val, next) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.next = (next===undefined ? null : next)
 * }
 */
/**
 * @param {ListNode} head
 * @return {ListNode}
 */
head = [1,1,2]
var deleteDuplicates = function(head) {
     if(head===null)return null
        let curr=head
     while(curr!==null&&curr.next!==null)
     {
         let p1=curr.next
         if(curr.val===p1.val)
         {
            curr.next=p1.next
         }else{
              curr=curr.next
         }
         
     }
     return head



};
console.log(deleteDuplicates(head));
